package ac.kr.incheon.android_gietae;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends Activity {

	private Context curContext;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		curContext = this;

		Button firstButton = (Button) findViewById(R.id.first_button);
		Button secondButton = (Button) findViewById(R.id.second_button);
		Button thirdButton = (Button) findViewById(R.id.third_button);
		Button fourButton = (Button) findViewById(R.id.four_button);

		firstButton.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent i = new Intent(curContext, SecondViewActivity.class);
				startActivity(i);
			}
		});

		secondButton.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent i = new Intent(curContext, SecondViewActivity.class);
				EditText inputField = (EditText) findViewById(R.id.editText1);
				String strInputText = inputField.getText().toString();
				i.putExtra("strInputText", strInputText);
				startActivity(i);

			}
		});
		
		thirdButton.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent i = new Intent(curContext, ThirdViewActivity.class);
				startActivity(i);
			}
		});
		
		fourButton.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent i = new Intent(curContext,FourViewActivity.class);
				startActivity(i);
			}
		});

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

}
